package com.siwei.infoextract.wrapper.featureextract;

import com.siwei.infoextract.wrapper.parser.Constraints;
import com.siwei.infoextract.wrapper.parser.DomNode;

public class InnerTextFeatureExtractor implements IFeatureExtrator {
	public Object extract(final DomNode domNode) {
		StringBuffer innerTextBuffer = new StringBuffer();

		int childrenCount = domNode.getChildrenCount();
		for (int i = 0; i < childrenCount; i++) {
			DomNode childDomNode = domNode.getChild(i);
			if (childDomNode.getName().equals(Constraints.TEXT_TAG_NAME)) {
				innerTextBuffer.append(childDomNode.getAttributes());
			}
		}
		return innerTextBuffer.toString();
	}
}
